﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Exercises.Actions;

namespace Exercises.Controllers
{
    [HandleError(Order = 2)]
    [HandleError(Order = 1, View = "DBConnectionError", ExceptionType = typeof(SqlException))]
    [BlockByIP(Order = 2, Networks = "192.0.0.1; 10.0.1.200; 127.0.0.2")]
    [MessageFilter(Order = 1, Message = "Modified by action")]
    public class HomeController : Controller
    {

        public ActionResult Index()
        {
            ViewData["Message"] = "Welcome to ASP.NET MVC!";

            SqlConnection conn;
            using (conn = new SqlConnection(@"data source=.\SQLEXPRESSThatDoesNotExists;Integrated Security=SSPI"))
            {
                conn.Open();
            }


            return View();
        }

        public ActionResult About()
        {
            return View();
        }
    }
}
